package com.inspur.edp.ai.flow.engine;

import com.inspur.edp.ai.flow.metadata.Edge;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * @author lizhaorui
 * @date 2025/9/5
 * @description
 */

@Data
public class NodeEdgeArriveRecord {

    private String nodeId;

    /**
     * 已经到达的边
     */
    private List<EdgeExtension> arrivedEdges;

    public NodeEdgeArriveRecord() {
        this.arrivedEdges = new ArrayList<>();
    }

    public void addEdge(Edge edge, boolean isEmptyPipe) {
        this.arrivedEdges.add(new EdgeExtension(edge, isEmptyPipe));
    }

    @Data
    public class EdgeExtension extends Edge {

        private boolean emptyPipe;

        public EdgeExtension(Edge edge, boolean emptyPipe) {
            this.setSourceNodeId(edge.getSourceNodeId());
            this.setSourcePort(edge.getSourcePort());
            this.setTargetNodeId(edge.getTargetNodeId());
            this.setTargetPort(edge.getTargetPort());
            this.emptyPipe = emptyPipe;
        }

    }
}